package com.example.module_properties.vm

import androidx.lifecycle.MutableLiveData
import com.yuwei.base.BaseViewModel
import com.yuwei.http.ApiService
import com.yuwei.http.entity.Properties
import com.yuwei.http.entity.PropertiesEntity
import com.yuwei.http.entity.PropertiesEntityItem
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
@HiltViewModel
class ProperTiesViewModel @Inject constructor(
    val apiService: ApiService
):BaseViewModel(){
    //列表
    val getProperSuccess by lazy { MutableLiveData<Properties>() }
    fun getPreopertiesList(){
        executeNetwork({
            apiService.getProperties()
        },getProperSuccess::postValue)
    }
    //根据RegionId请求
    val getRegionSuccess by lazy { MutableLiveData<PropertiesEntity>() }
    fun getRegionPrep(region:Int){
        executeNetwork({
           apiService.getRegion(region)
        },getRegionSuccess::postValue)
    }

}